package com.cqc.jdk8.Jutil.concurrent.locks.ReentrantLock.demo3;


import java.util.concurrent.TimeUnit;


public class ThreadTest {
    /**
     * synchronized(this)和 ReentrantLock的监视器相同吗?
     * 答：只要这两个锁是不同的对象实例，那么它们各自的监视器也是不同的
     * 日志：
     * add() start...Thread-0:0
     * add2() start...Thread-1:0
     * add2() end...Thread-1:2
     * add() end...Thread-0:2
     * 显示 AThread add()，然后是 BThread add2()  说明不是同一个监视器
     *
     *
     */
    public static void main(String[] args) throws InterruptedException {
        Counter counter = new Counter();
        AThread aThread = new AThread(counter);
        aThread.start();
        BThread bThread = new BThread(counter);
        bThread.start();
    }
}
